﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataAccessLayer;
using MyCommon;

namespace BussinessLayer
{
    public class LoaiDichVuBO : BaseBO
    {
        private static LoaiDichVuBO _instance;
        private LoaiDichVuBO()
        {}
        public static LoaiDichVuBO getInstance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new LoaiDichVuBO();
                }
                return _instance;
            }
        }
        public IEnumerable<LoaiDichVu> GetAllLoaiDichVu()
        {
            return _dao.LoaiDichVu.GetAllLoaiDichVu();
        }
        public LoaiDichVu GetLoaiDichVuById(int id)
        {
            return _dao.LoaiDichVu.GetLoaiDichVuById(id);
        }
        public bool UpdateLoaiDichVu(LoaiDichVu inLoaiDichVu)
        {
            return _dao.LoaiDichVu.UpdateLoaiDichVu(inLoaiDichVu);
        }
        public bool InsertLoaiDichVu(LoaiDichVu inLoaiDichVu)
        {
            return _dao.LoaiDichVu.InsertLoaiDichVu(inLoaiDichVu);
        }
        public ReturnValue<bool> DelLoaiDichVu(int id)
        {
            return _dao.LoaiDichVu.DelLoaiDichVu(id);
        }
        public string GenerateMaLoaiDichVu()
        {
            LoaiDichVu aObj = _dao.LoaiDichVu.GetLastRecord();
            if (aObj != null)
            {
                return Utils.GenerateCode(CodeType.LoaiDichVu, aObj.Id + 1);
            }
            else
            {
                return Utils.GenerateCode(CodeType.LoaiDichVu, 1);
            }

        }
    }
}
